<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!--{include file='comm/header.tpl'}-->
    <!--{if $operFlg == 6}-->
        <title>账户异动新增</title>
    <!--{else}-->
        <title>账户异动编辑</title>
    <!--{/if}-->
</head>
<body>
<div style="width:100%">

    <div class="items clearfix">
        <h2 style="" class="tal">正在操作：<!--{if $operFlg == 6}-->账户异动新增<!--{else}-->账户异动编辑<!--{/if}--></h2>
        <div class="items2">

            <!--{if $error_msg}-->

            <div class="error-box">
                <!--{$error_msg}-->
            </div>

            <!--{else}-->

            <form id="account_form" onsubmit="return false;">
                <table>
                    <tbody>
                        <tr>
                            <td class="tar" width="150">用户名：</td>
                            <td width="*"><input type="text" value="<!--{$accountChange.custID}-->" style="width:200px;" id="custID" name="custID" autocomplete="off"><font color="red">*</font> </td>
                        </tr>
                        <tr>
                            <td class="tar">异动账户：</td>
                            <td>
                                <select style="width:100px;" id="payTypeID" name="payTypeID">
                                <!--{if $accountChange.payTypeID == 2}-->
                                	<option selected value="2">余额</option>
									<option value="3">积分</option>
                                <!--{elseif $accountChange.payTypeID == 3}-->
                                	<option value="2">余额</option>
									<option selected value="3">积分</option>
                                <!--{else}-->
                                	<option selected value="2">余额</option>
									<option value="3">积分</option>
                                <!--{/if}-->
								</select>
								<font color="red">*</font>
                            </td>
                        </tr>
                        <tr>
                            <td class="tar">金额：</td>
                            <td>
                            <!--{if $accountChange.changeAmount > 0}-->
								<input name="type" value="1" checked type="radio">充值
								<input name="type" value="0" type="radio">消费
							<!--{elseif $accountChange.changeAmount < 0}-->
								<input name="type" value="1" type="radio">充值
								<input name="type" value="0" checked type="radio">消费
							<!--{else}-->
								<input name="type" value="1" checked type="radio">充值
								<input name="type" value="0" type="radio">消费
							<!--{/if}-->
								<input autocomplete="off" name="changeAmount" id="changeAmount" value="10.00" style="width:100px;" type="text"><font color="red">*</font> 
                            </td>
                        </tr>
                        
                        <tr>
                            <td class="tar">来源：</td>
                            <td>
                                <select style="width:100px;" id="sourceID" name="sourceID">
								<option value="0">请选择</option>
								<!--{foreach from=$itemList item=source}-->
									<option value="<!--{$source.itemID}-->" <!--{if $accountChange.sourceID == $source.itemID}-->selected<!--{/if}-->><!--{$source.itemName}--></option>
								<!--{/foreach}-->
								</select>
								<font color="red">*</font> 
                            </td>
                        </tr>
                        <tr>
                            <td class="tar">备注：</td>
                            <td>
                                <textarea style="width:300px;height:100px" id="remark" name="remark"></textarea>
                                <input type="hidden" value="<!--{$accountChange.changeID}-->" name="changeID">
                                <input type="hidden" value="<!--{$accountChange.changeStatus}-->" name="changeStatus">
                            </td>
                        </tr>
                    </tbody>
                </table>
            </form>
            <!--{/if}-->
        </div>
    </div>


    <div class="bottom_fixbox">
        <div class="rectbox tac">
            <input type="button" class="btn" onclick="account.check();" value="<!--{if $operFlg == 6}-->账户异动新增<!--{else}-->账户异动编辑<!--{/if}-->" />&nbsp;&nbsp;&nbsp;
            <input type="button" class="btn" onclick="E.closeWindows();" value="关闭" />
        </div>
    </div>



</div>

<script type="text/javascript">

    var account = {

        dt: "",

        operFlg: <!--{$operFlg}-->,

        check: function() {
            this.dt = E.getFormValues("account_form");
            var error_msg = "";
            if (this.dt.custID == "")
                error_msg += "用户名不能为空<br />";
            if (this.dt.payTypeID == "")
                error_msg += "请选择异动账户类型<br />";
			if (this.dt.type != 1 && this.dt.type != '0')
                error_msg += "请选择金额类型<br />";
            if (this.dt.changeAmount == '')
                error_msg += "金额数不能为空<br />";
            if (this.dt.sourceID == '')
                error_msg += "请选择来源<br />";
                
                
            if (error_msg != "")
                E.alert(error_msg);
            else {
                <!--{if $operFlg == 6}-->	//新增
                E.confirm("您确定新增账户异动吗？", "account.add");
                <!--{else}-->	//编辑
                E.confirm("您确定修改账户异动吗？", "account.add");
                <!--{/if}-->
            }

        },

        add: function() {
        	$.ajax({
                type: "POST",
                url: "/invokingAjax-backend/customer/customer.ajax?operFlg=6",
                dataType: "JSON",
                data: this.dt,
                success: function( o ) {
                    if (o.code == 200) {
                        E.opener("account.load");
                        if (account.operFlg == 6) {	//新增
                            E.alert(o.message, 2, "E.refresh");
                        } else {
                            E.alert(o.message, 2, "E.closeWindows");
                        }
                    } else {
                        E.alert(o.message);
                    }
                }
            });
        }
    };

</script>

</body>

</html>
